package simulation.initiatives;

import simulation.SimEngine;
import common.IGrid;
import common.SimulationSettings;

public abstract class AbstractEngine implements IEngine {
  protected SimEngine simEngine;
  
  public AbstractEngine(SimulationSettings settings) {
    simEngine = new SimEngine(settings.getGridSpacing(), settings.getRadius());
  }
    
  public void step() {
    simEngine.step();
  }
  
  public void setGridSpacing(int gridSpacing, int newRadius) {
    simEngine.setGridSpacing(gridSpacing, newRadius);
  }
  
  /**
   * @return the grid holding the latest iteration
   */
  public synchronized IGrid getGrid() {
    return simEngine.getGrid();
  }
  
  public void setSimTimeStep(int minutes) {
    simEngine.setSimTimeStep(minutes);
  }
  
  public void adjustBufferRate(int newRate) {
    //should be implemented by the buffer engine class
  }
  
  //These are "implemented" here as a convenience so extending 
  //classes can just override the methods they need  
  public void adjustDisplayRate(int newRate) {}
  public void start() {}
  public void pause() {}
  public void reset() {} 
  
}
